package com.upb.webserver.common.enums;

import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum ContractStatusEnum {
    DEPLOYING(0, "部署中（fabric专有）"),
    NOT_DEPLOY(1, "未部署"),
    DEPLOY_SUCCESS(2, "已部署"),
    DEPLOY_FAIL(3, "部署失败"),
    ;

    private byte id;
    private String description;


    ContractStatusEnum(int id, String description) {
        this.id = (byte) id;
        this.description = description;
    }

    public byte getId() {
        return this.id;
    }

    /**
     * @param id
     * @return
     */
    public static ContractStatusEnum getById(byte id) {
        for (ContractStatusEnum value : ContractStatusEnum.values()) {
            if (value.id == id) {
                return value;
            }
        }
        return null;
    }
}
